// 基础响应类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
  pagination?: {
    page: number;
    pageSize: number;
    total: number;
    totalPages: number;
  };
}

// 分页参数
export interface PaginationParams {
  page?: number;
  pageSize?: number;
  sortBy?: string;
  sortOrder?: "asc" | "desc";
}

// 分页响应
export interface PaginatedResponse<T> extends ApiResponse<T[]> {
  pagination: {
    page: number;
    pageSize: number;
    total: number;
    totalPages: number;
  };
}

// 用户相关类型
export interface User {
  id: number;
  username: string;
  email: string;
  phone?: string;
  realName: string;
  avatar?: string;
  department?: string;
  classInfo?: string;
  status: "active" | "inactive" | "suspended";
  createdAt: string;
  updatedAt: string;
}

export interface CreateUserRequest {
  username: string;
  password: string;
  email: string;
  phone?: string;
  realName: string;
  department?: string;
  classInfo?: string;
}

export interface UpdateUserRequest {
  email?: string;
  phone?: string;
  realName?: string;
  department?: string;
  classInfo?: string;
  status?: "active" | "inactive" | "suspended";
}

// 角色相关类型
export interface Role {
  id: number;
  name: string;
  description?: string;
  permissions: string[];
  createdAt: string;
}

export interface CreateRoleRequest {
  name: string;
  description?: string;
  permissions: string[];
}

// 知识分类类型
export interface KnowledgeCategory {
  id: number;
  name: string;
  description?: string;
  icon?: string;
  sortOrder: number;
  isActive: boolean;
  articleCount: number;
  createdAt: string;
}

// 知识文章类型
export interface KnowledgeArticle {
  id: number;
  title: string;
  summary?: string;
  content: string;
  categoryId: number;
  authorId: number;
  coverImage?: string;
  readCount: number;
  likeCount: number;
  isFeatured: boolean;
  isPublished: boolean;
  publishedAt?: string;
  createdAt: string;
  updatedAt: string;
}

// 事件类型
export interface EventType {
  id: number;
  name: string;
  description?: string;
  icon?: string;
  priorityLevel: "low" | "medium" | "high" | "critical";
  defaultHandlers: number[];
  color?: string;
  isActive: boolean;
  createdAt: string;
}

// 紧急事件类型
export interface EmergencyEvent {
  id: number;
  title: string;
  description?: string;
  eventTypeId: number;
  reporterId: number;
  location?: string;
  latitude?: number;
  longitude?: number;
  urgencyLevel: "low" | "medium" | "high" | "critical";
  status: "pending" | "processing" | "resolved" | "closed";
  attachments?: string[];
  assignedHandlers: number[];
  resolvedAt?: string;
  reportedAt: string;
  createdAt: string;
  updatedAt: string;
}

// 志愿者类型
export interface Volunteer {
  id: number;
  userId: number;
  applicationReason: string;
  emergencyContact?: string;
  skills?: string;
  availableTimeSlots?: any;
  status: "pending" | "approved" | "rejected";
  appliedAt: string;
  reviewedAt?: string;
  reviewedBy?: number;
  reviewComment?: string;
}

// 通知类型
export interface Notification {
  id: number;
  title: string;
  content: string;
  type: "system" | "event" | "knowledge" | "volunteer";
  targetUsers: number[];
  sendType: "all" | "specified";
  sentAt: string;
  createdBy: number;
}

// 文件上传类型
export interface UploadedFile {
  id: number;
  originalName: string;
  fileName: string;
  filePath: string;
  fileSize: number;
  mimeType?: string;
  uploadedBy: number;
  relatedType: "event" | "article" | "video" | "other";
  relatedId?: number;
  createdAt: string;
}
